<template>
    <!-- // 4GMR结构指标-小区(天) -->
    <index-card :indexCardTitle="indexCardTitle">
        <el-table :data="tableData" v-loading="loading">
            <el-table-column prop="starttime" label="开始时间" min-width="200">
                <template #default="scope">
                    {{ scope.row.starttime ? formatDateNormal(scope.row.starttime) : null }}
                </template>
            </el-table-column>
            <el-table-column prop="cityName" label="地市名称" min-width="200" />
            <el-table-column prop="cityId" label="地市编号" min-width="200" />
            <el-table-column prop="cgi" label="小区CGI" min-width="200" />
            <el-table-column prop="cellName" label="小区中文名" min-width="200" />
            <el-table-column prop="mroTotal" label="总采样点数" min-width="200" />
            <el-table-column prop="mroOverlapTotal" label="重叠覆盖采样点数" min-width="200" />
            <el-table-column prop="mroOverlapRate" label="重叠覆盖度(%)" min-width="200" />
            <el-table-column prop="rsrpCteqNeg110Rate" label="RSRP覆盖率(≥-110dbm)(%)" min-width="200" />
            <el-table-column prop="cqiLt7Rate" label="低CQI占比(%)" min-width="200" />
        </el-table>
    </index-card>
</template>

<script setup>
import { ref } from "vue";
import { apiCommon, formatDateNormal } from "@/utils/index.js";
import * as qualityApi from "@/api/biz/networkQuality";
import mittBus from "@/utils/mittBus"; // mitt事件总线

mittBus.on("get4GIndexItemData", (params) => {
    getData(params)
});

const props = defineProps({
    indexCardTitle: {
        type: String,
        default: '',
    },
    rowsData: {
        type: Object,
        default: () => { },
    },
});

const tableData = ref([]);
let loading = ref(false);

const getData = async (params) => {
    // console.log('params', params)

    loading.value = true;
    tableData.value = await apiCommon(qualityApi.getMR4gStructureList, params);
    tableData.value = tableData.value.data;
    loading.value = false;

    mittBus.emit("setIndexFlag", false)
}

getData(props.rowsData);
</script>